/*
 * 
 * 存储pageSiderbar点击展开事件
 * 
 */

$(function(){
	//页面刷新去掉class="open"属性
	$('.sidebar-menu li').removeClass('open');
	//获取当前页面URL地址
	var str = window.location.pathname;
	//截取/admin/后的字符串
	var myUrl=str.split('/admin/')[1];
	
	String.prototype.startWith=function(str){    
		  var reg=new RegExp("^"+str);    
		  return reg.test(this);       
		};  

	if(myUrl.startWith('user/toTeachers.htm')){
		$('#user').addClass('open');
	}
	if(myUrl.startWith('user/toStudents.htm')){
		$('#user').addClass('open');
	}
	if(myUrl.startWith('user/toRecommendTeachers.htm')){
		$('#user').addClass('open');
	}
	if(myUrl.startWith('reservation/toReservationApprove.htm')){
		$('#reservationn').addClass('open');
	}
	if(myUrl.startWith('reservation/toReservationAdmin.htm')){
		$('#reservationn').addClass('open');
	}
	if(myUrl.startWith('reservation/toReservation.htm')){
		$('#reservationn').addClass('open');
	}
	if(myUrl.startWith('userReservation/toUserReservation.htm')){
		$('#reservationn').addClass('open');
	}
	if(myUrl.startWith('friend/toFriend.htm')){
		$('#room').addClass('open');
	}
	if(myUrl.startWith('school/toSchool.htm')){
		$('#system').addClass('open');
	}
	if(myUrl.startWith('message/toMessage.htm')){
		$('#system').addClass('open');
	}
	if(myUrl.startWith('complain/toComplain.htm')){
		$('#system').addClass('open');
	}
	if(myUrl.startWith('interest/toInterest.htm')){
		$('#system').addClass('open');
	}
	if(myUrl.startWith('adminAppend.htm')){
		$('#system').addClass('open');
	}
	if(myUrl.startWith('record/toUser.htm')){
		$('#record').addClass('open');
	}
	if(myUrl.startWith('record/toManager.htm')){
		$('#record').addClass('open');
	}
	
	
	
});